package com.jingdianjichi.subject.domain.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.concurrent.*;

/**
 * 线程池配置
 */
@Configuration
public class ThreadPoolConfig {

    @Bean("labelThreadPool")
    public ThreadPoolExecutor labelThreadPool(){
        return new ThreadPoolExecutor(10,
                20,
                5,
                TimeUnit.SECONDS,
                new LinkedBlockingQueue<>(),
                new CustomThreadFactory("label"),
                new ThreadPoolExecutor.CallerRunsPolicy());
    }
}
